package fnord.illuminati.card;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

public enum Alignment implements Serializable {
	GOVERNMENT,COMMUNIST,CRIMINAL,FANATIC,LIBERAL,CONSERVATIVE,STRAIGHT,WEIRD,VIOLENT,PEACEFUL;
	
	public Alignment getAlliedType() {
		switch (this) {
		case GOVERNMENT: return GOVERNMENT;
		case COMMUNIST: return COMMUNIST;
		case LIBERAL: return LIBERAL;
		case CONSERVATIVE: return CONSERVATIVE;
		case PEACEFUL: return PEACEFUL;
		case VIOLENT: return VIOLENT;
		case STRAIGHT: return STRAIGHT;
		case WEIRD: return WEIRD;
		case CRIMINAL: return CRIMINAL;
		case FANATIC: return null;
		default: return this;
		}
	}
	
	public String toString() {
		switch (this) {
		case GOVERNMENT: return "Government";
		case COMMUNIST: return "Communist";
		case LIBERAL: return "Liberal";
		case CONSERVATIVE: return "Convervative";
		case PEACEFUL: return "Peaceful";
		case VIOLENT: return "Violent";
		case STRAIGHT: return "Straight";
		case WEIRD: return "Weird";
		case CRIMINAL: return "Criminal";
		case FANATIC: return "Fanatic";
		default: return null;
		}
	}
	
	public Alignment getOpposingType() {
		switch (this) {
		case GOVERNMENT: return COMMUNIST;
		case COMMUNIST: return GOVERNMENT;
		case LIBERAL: return CONSERVATIVE;
		case CONSERVATIVE: return LIBERAL;
		case PEACEFUL: return VIOLENT;
		case VIOLENT: return PEACEFUL;
		case STRAIGHT: return WEIRD;
		case WEIRD: return STRAIGHT;
		case CRIMINAL: return null;
		case FANATIC: return FANATIC;
		default: return null;
		}
	}

	public static Collection<Alignment> getAll() {
		Set<Alignment> ret = new HashSet<Alignment>();
		
		ret.add(Alignment.COMMUNIST);
		ret.add(Alignment.CONSERVATIVE);
		ret.add(Alignment.CRIMINAL);
		ret.add(Alignment.FANATIC);
		ret.add(Alignment.GOVERNMENT);
		ret.add(Alignment.LIBERAL);
		ret.add(Alignment.PEACEFUL);
		ret.add(Alignment.STRAIGHT);
		ret.add(Alignment.VIOLENT);
		ret.add(Alignment.WEIRD);
		
		return ret;
	}
}
